//
//  ViewController.m
//  BeanSproutEDU
//
//  Created by douya on 15/1/6.
//  Copyright (c) 2015年 douya. All rights reserved.
//

#import "ViewController.h"
#import "MainViewController.h"
#import "InterestChoiceViewController.h"
#import "Header.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    
    
    
//    NSUserDefaults *userDefaults=[NSUserDefaults standardUserDefaults];
    MainViewController *main=[[MainViewController alloc] init];
    
    OrientationNavigationController *nav=[[OrientationNavigationController alloc] initWithRootViewController:main];
    
    NSArray *array=[UIApplication sharedApplication].windows;
    UIWindow *mainWindow=array[0];
    
    mainWindow.rootViewController=nav;
    
//    NSString *isFirst=[userDefaults objectForKey:@"FIRST"];
    
//    if (/* DISABLES CODE */ (YES))//已经不是第一次进入，所以直接进入主界面
//    {
//       
//        
//    }
//    else//第一次进入，先进入引导界面
//    {
//        UIScrollView *scrollView=[[UIScrollView alloc] initWithFrame:self.view.frame];
//        
//        scrollView.delegate=self;
//        
//        scrollView.tag=100;
//        
//        scrollView.bounces=NO;
//        
//        scrollView.contentSize=CGSizeMake(3*SCREENWIDTH, SCREENHEIGHT);
//        
//        scrollView.pagingEnabled=YES;
//        
//        scrollView.showsHorizontalScrollIndicator=NO;//取消水平线显示
//        
//        for (int i=0; i<3; i++)
//        {
// 
//            UIImageView *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(i*SCREENWIDTH, 0, SCREENWIDTH, SCREENHEIGHT)];
//            
//            imageView.image=[UIImage imageNamed:[NSString stringWithFormat:@"splash%d.jpg",i+1]];
//            
//            [scrollView addSubview:imageView];
//            
//        }
//        
//        _pageControl=[[UIPageControl alloc] initWithFrame:CGRectMake(SCREENWIDTH/2-50, SCREENHEIGHT-40, 100, 30)];
//        _pageControl.currentPage=0;
//        _pageControl.numberOfPages=3;
//        _pageControl.backgroundColor=[UIColor clearColor];
//        _pageControl.currentPageIndicatorTintColor=[UIColor greenColor];
//        _pageControl.pageIndicatorTintColor=[UIColor groupTableViewBackgroundColor];
//        
//        
//        
//        UIButton *goBtn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
//        goBtn.frame=CGRectMake(SCREENWIDTH*2+SCREENWIDTH/2-75, SCREENHEIGHT-100, 150, 50);
//        [goBtn setTitle:@"马上进入-->" forState:UIControlStateNormal];
//        [goBtn setBackgroundColor:[UIColor clearColor]];
//        [goBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//        goBtn.titleLabel.font=[UIFont fontWithName:@"Helvetica-Bold" size:20];
//        [goBtn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
//        [scrollView addSubview:goBtn];
//        [self.view addSubview:scrollView];
//        [self.view addSubview:_pageControl];
//        
//        
//    }
    
    
}
////调用scrollview的delegate方法来控制pagecontrol的改变
//-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
//{
////    NSLog(@"将要结束滑动");
//    CGPoint point=scrollView.contentOffset;
//    _pageControl.currentPage=point.x/320;
//}
//-(void)btnClick
//{
//    [[self.view viewWithTag:100] removeFromSuperview];
//    
//    InterestChoiceViewController *interest=[[InterestChoiceViewController alloc] init];
//    OrientationNavigationController *nav=[[OrientationNavigationController alloc] initWithRootViewController:interest];
//    
//    NSArray *array=[UIApplication sharedApplication].windows;
//    UIWindow *mainWindow=array[0];
//    
//    mainWindow.rootViewController=nav;
//    
//    NSUserDefaults *defatlts=[NSUserDefaults standardUserDefaults];
//    [defatlts setObject:@"YES" forKey:@"FIRST"];
//    
//    
//}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//此方法是iOS6之前的方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{
    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
//此方法是iOS6之后的方法
- (BOOL)shouldAutorotate

{
    return NO;
}

//- (NSUInteger)supportedInterfaceOrientations
//
//{
//    
//    return UIInterfaceOrientationMaskPortrait;//只支持这一个方向(正常的方向)
//    
//}

@end
